Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use header info for interchain accounts address generation #7713

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

damiannolan
Copy link
Member

Description

Removes UnwrapSDKContext for interchain accounts.
Now uses block hash (merkle root of block) instead of dataHash for interchain accounts address generation.

The ctx.BlockHeader is deprecated and recommended to now use service based approach. The HeaderService provided by cosmos-sdk returns header.Info which only contains appHash, hash (merkle root of block), height, time and chainID.

It is recommended to use cometservice when anything else is needed.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@damiannolan damiannolan marked this pull request as ready for review December 17, 2024 18:55
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! LGTM!

Copy link
Member

@AdityaSripal AdityaSripal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in principle. But my understanding is that we can just go back to deterministic address generation because addresses are no longer instantiated as base accounts on receive. So we no longer have to protect against DoS attacks with the new sdk changes

buf = append(buf, header.AppHash...)
buf = append(buf, header.DataHash...)
buf = append(buf, headerInfo.AppHash...)
buf = append(buf, headerInfo.Hash...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we no longer get access to datahash directly? Is there a reason it isn't in header info?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a question for the sdk team I think.

@damiannolan
Copy link
Member Author

Looks good in principle. But my understanding is that we can just go back to deterministic address generation because addresses are no longer instantiated as base accounts on receive. So we no longer have to protect against DoS attacks with the new sdk changes

Agree! That skipped my mind about the removal of account creation from SendCoins. I guess we could removal the block fields entirely from the address generation now. I will merge this PR and that can be discussed later if its something that wants to be done.

@damiannolan damiannolan added this pull request to the merge queue Dec 18, 2024
Copy link

Merged via the queue into main with commit c15bb5c Dec 18, 2024
71 checks passed
@damiannolan damiannolan deleted the damian/update-icahost-address-generation branch December 18, 2024 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants